cmake_minimum_required(VERSION 2.6)

project(EdgeCXX-trt-predictor)

# Set output dir
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)

# Set build configs
add_definitions(-std=c++11)
option(CUDA_USE_STATIC_CUDA_RUNTIME OFF)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Ofast -Wfatal-errors -D_MWAITXINTRIN_H_INCLUDED")

# Set include dir
include_directories(include)
include_directories(/usr/local/cuda/include)
link_directories(/usr/local/cuda/lib64)

# Find packages
find_package(CUDA REQUIRED)
find_package(OpenCV)
include_directories(${OpenCV_INCLUDE_DIRS})

# Make trt-predict library
add_library(trtpre SHARED source/trt_predictor.cpp source/trt_utils.cpp)
target_link_libraries(trtpre nvinfer cudart ${OpenCV_LIBS})

# Make trt-predic demo
add_executable(demo_trt_predictor demo/demo_trt_predictor.cpp)
target_link_libraries(demo_trt_predictor trtpre)
